package uva;
/**
 Sample Input 

abcac
bcd
aaa
aabaaaa
Sample Output 

3
1 Delete 1
2 Replace 3,d
3 Delete 4

4
1 Insert 1,a
2 Insert 2,a
3 Insert 3,b
4 Insert 7,a
Though above test pass but still have some issues which need to be fixed, as solution is not accepted.
 */
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class DP_String_526 {
	
	public static void main(String[] args) {
		PrintWriter pw = new PrintWriter(System.out);
		Scanner scn = new Scanner(System.in);
		int cases = 0;
		while(cases < 1 && scn.hasNextLine() ){
			if(cases++!=0)pw.println();
			String str1 = scn.nextLine();
			String str2 = scn.nextLine();
			//while((str2 = scn.nextLine()).length() == 0);
			
			int[][] dptable = new int[str1.length()+1][str2.length()+1];
			char[][] backtrack = new char[str1.length()+1][str2.length()+1];
			for(int i=0 ; i<dptable.length; i++){
				for(int j=0; j<dptable[i].length; j++){
					if(i==0 && j==0){
						dptable[i][j] = 0;
						backtrack[i][j]= 'E';
					}else if(i==0){
						dptable[i][j] = j;
						backtrack[i][j] = 'I';
					}else if(j==0){
						dptable[i][j] = i; 
						backtrack[i][j] = 'D';
					}
				}
			}
			for(int i=1 ; i<dptable.length; i++){
				for(int j=1; j<dptable[i].length; j++){
					dptable[i][j] = Math.min(str1.charAt(i-1) == str2.charAt(j-1) ? dptable[i-1][j-1] : dptable[i-1][j-1] +1, Math.min(dptable[i][j-1]+1, dptable[i-1][j]+1) );
					char op = 'E';
					if(str1.charAt(i-1) != str2.charAt(j-1)){
						op = dptable[i-1][j-1]< dptable[i-1][j] ? 'R' : 'D';
						op = Math.min(dptable[i-1][j-1], dptable[i-1][j]) < dptable[i][j-1] ? op : 'I'; 
					}
					backtrack[i][j] = op;
				}
			}
			int totalop =dptable[str1.length()][str2.length()]; 
			pw.println(totalop);
			StringBuffer res = new StringBuffer();
			int[] idx = new int[totalop];
			int trc = 0;
			int i = str1.length();
			int j = str2.length();
			while(j >=0){
				char ch = backtrack[i][j];
				if(ch == 'E'){
					i--;j--;
				}else if(ch =='I'){
					res.append('I').append(str2.charAt(j-1));
					idx[trc++] = i;
					j--;
				}else if(ch == 'D'){
					res.append('D').append(' ');
					idx[trc++] = i;
					i--;
				}else if(ch == 'R'){
					res.append('R').append(str2.charAt(j-1));
					idx[trc++] = i;
					i--; j--;
				}else if(j ==0) break;
			}
			int delCount =0;
			int insCount = 0;
			int count = 0;
			int ii = totalop-1;
			for(int id = res.length()-1; id>=0; id= id-2){
				int index = idx[ii--];
				if(index <=0) index = 1;
				index = index -delCount + insCount;
				char val = res.charAt(id);
				char ch = res.charAt(id-1);
				if(ch == 'D'){
					delCount++;
					pw.format("%d Delete %d\n",++count,index);
				}else if(ch == 'I'){
					pw.format("%d Insert %d,%c\n",++count,  index, val);
					insCount++;
				}else if(ch == 'R'){
					pw.format("%d Replace %d,%c\n", ++count, index, val);
				}
			}
		}
		pw.close();
		
	}
	
	

}
